$(function (){

    // 初始化列表
    var name = getCookie("exec-shell-name");
    $.get("/job/getSavePoint?jobName=" + name, function(req) {
        var table_html = "";
        for (let i = 1; i <= req.length; i++) {
            var data = req[i - 1];
            table_html += "<tr>  " +
                "              <td>" + i + "</td>  " +
                "              <td>" + data.jobName + "</td>  " +
                "              <td>" + data.fileTimeString + "</td>  " +
                "              <td>" +
                "                  <a title=\"启动\" href=\"javascript:;\" style=\"cursor:pointer;\" onclick=\"startWithSavePoint('" + data.jobName + "', '" + data.filePath + "')\">" +
                "                       <i class=\"layui-icon\">&#xe652;</i>" +
                "                  </a>" +
                "              </td>  " +
                "          </tr>"
        }
        $("#table_body").html(table_html);
    });
});

function startWithSavePoint(name, path) {
    var title = "启动-使用SAVEPOINT：" + name;
    document.cookie = "exec-shell-name=" + name;
    document.cookie = "exec-shell-path=" + path;
    document.cookie = "exec-shell-type=startWithSavePoint";
    xadmin.open(title,'/flink-operate.html', null, null, true);
}